{% extends "admin.html" %}

{% block jsfuncs %}

del_com = function(com_id) {
	
	var req = new Request.HTML({ 	url: '/admin/comments/del',
	 									  	method: 'post',
										  	evalScripts : true,
										  	data: 'id=' + com_id
										}).send();
	return false;
};


{% endblock %}

{% block content %}
	<h3>评论列表</h3>
	<div id="comments">
	{% if comments|length %}
	
	<table>
	
			<tr>
			<td class="td_button"></td>
			<th>网友</th>
			<th>内容</th>
			<th class="td_date">时间</th>
			</tr>
		
		{% for com in comments %}
			<tr id="{{com.key}}">
				<td class="td_buttond"><a href="#" onclick="javascript:del_com('{{com.key }}');">删除</a></td>	
				<td class="com_author">{{ com.author }}</td>
				<td class="com_text">{{ com.text|escape|linebreaks }}</td>
				<td class="td_date">{{ com.date|date:"d/m/Y H:i"}}</td>
			</tr>
		{% endfor %}
	</table>
	<div id="nav">
		{% if navigation.previous_list %}
			<a href="/admin/comments/?offset=1" class="nav"><<</a>
			{% for item in navigation.previous_list %}
				<a href="/admin/comments/?offset={{item}}" class="nav">{{item}}</a>
			{% endfor %}
		{% endif %}
		<span class="nav current">{{ navigation.current }}</span>
		{% if navigation.next_list %}
			{% for item in navigation.next_list %}
				<a href="/admin/comments/?offset={{item}}" class="nav">{{item}}</a>
			{% endfor %}
				<a href="/admin/comments/?offset={{navigation.last}}" class="nav">>></a>
		{% endif %}
		
	</div>
	{% else %}
		<h4>没有任何评论！</h4>
	{% endif %}
	</div>
	
	
	{% block comments %}

	{% endblock %}
{% endblock %}